package www.openteam.com.tool;

import android.content.Context;
import android.graphics.Color;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

public class ToastUtil {
	private static Toast toast;
	/**
	 * 能够连续弹的吐司，不会等上个吐司消失
	 * @param context
	 * @param text
	 */
	public static void showToast(Context context,String text){
		if(toast==null){
			toast = Toast.makeText(context, text, Toast.LENGTH_SHORT);
			LinearLayout layout = (LinearLayout) toast.getView();
			layout.setBackgroundColor(Color.parseColor("#000000"));
			TextView v = (TextView) toast.getView().findViewById(android.R.id.message);
			v.setTextColor(Color.WHITE);
			v.setTextSize(20);

		}
		toast.setText(text);//将text文本设置给吐司
		toast.show();
	}
}
